//
//  VerifyViewController.m
//  WE
//
//  Created by apple on 15/12/3.
//  Copyright © 2015年 UNOHACHA. All rights reserved.
//

#import "VerifyViewController.h"
#import <Masonry.h>
#import "Size.h"
#import "SubmitTailView.h"

@interface VerifyViewController ()<UITextFieldDelegate>{
    UIButton *buttonUnderstand;
    BOOL flag;
}

@end

@implementation VerifyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    flag = YES;
    // Do any additional setup after loading the view.
    self.navigationItem.title = self.string;
    self.view.backgroundColor = [UIColor colorWithRed:229/255. green:229/255. blue:229/255. alpha:1.0];
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 84, WindowWidth, 50)];
    view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:view];
    UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(15*Width, 15, 20*Width, 20*Height)];
    imageV.image = [UIImage imageNamed:@"login"];
    
    [view addSubview:imageV];
    
    
    
   UITextField* numbaerText = [[UITextField alloc] initWithFrame:CGRectMake(50*Width, 10, WindowWidth - 50*Width, 30)];
    numbaerText.placeholder = @"手机号";
    numbaerText.delegate = self;
    [view addSubview:numbaerText];
    
    if ([self.string isEqualToString:@"注册"]) {
        
        buttonUnderstand  = [UIButton buttonWithType:UIButtonTypeSystem];
        buttonUnderstand.frame = CGRectMake(10 , 140, 16, 16);
        //设置按钮图片
        [buttonUnderstand setBackgroundImage:[UIImage imageNamed:@"gou.png"] forState:UIControlStateNormal];
        
        //设置按钮点击事件
        [buttonUnderstand addTarget:self action:@selector(understand:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:buttonUnderstand];
        
         UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(36, 140, WindowWidth/11*2, 16)];
        label.font = [UIFont systemFontOfSize:13];
        label.text = @"我已经了解";
        [self.view addSubview:label];
      UIButton *  buttonInstructions  = [UIButton buttonWithType:UIButtonTypeSystem];
        buttonInstructions.frame = CGRectMake(WindowWidth/11*2 + 42 , 140, WindowWidth/11*9, 12);
        //设置按钮上的文字
        [buttonInstructions setTitle:@"《微医快约申请须知》" forState:UIControlStateNormal];
        //设置按钮点击事件
        [buttonInstructions addTarget:self action:@selector(Instructions) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:buttonInstructions];
    }
    
    UIButton *loginButton = [UIButton buttonWithType:UIButtonTypeCustom];
    loginButton.frame = CGRectMake(10*Width, 180, 355*Width, 40*Height);
    [loginButton setTitle:@"获取验证码" forState:UIControlStateNormal];
    [loginButton addTarget:self action:@selector(pressLoginButton) forControlEvents:UIControlEventTouchUpInside];
    loginButton.backgroundColor = [UIColor blueColor];
    [loginButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.view addSubview:loginButton];
    
    
    
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.view endEditing:YES];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    
    [self.view endEditing:YES];
    return YES;
}


- (void)understand:(UIButton*)butt{
    if (flag) {
        [buttonUnderstand setBackgroundImage:[UIImage imageNamed:@"box"] forState:UIControlStateNormal];
    }else {
        [buttonUnderstand setBackgroundImage:[UIImage imageNamed:@"gou.png"] forState:UIControlStateNormal];
    }
    
    flag = !flag;
}

- (void)Instructions{
    
}

- (void)pressLoginButton{
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
